#include "Rp2Renderer.h"

using namespace Rp2;

//---------------------------------------------------------------------------------------------------
void Renderer::SetPolygonOffsetState(PolygonOffsetState* pkOffsetState)
{
    m_aspkState[GlobalState::POLYGONOFFSET] = pkOffsetState;

	if (pkOffsetState->FillEnabled)
	{
		glEnable(GL_POLYGON_OFFSET_FILL);
	}
	else
	{
		glDisable(GL_POLYGON_OFFSET_FILL);
	}

	if (pkOffsetState->LineEnabled)
	{
		glEnable(GL_POLYGON_OFFSET_LINE);
	}
	else
	{
		glDisable(GL_POLYGON_OFFSET_LINE);
	}

	if (pkOffsetState->PointEnabled)
	{
		glEnable(GL_POLYGON_OFFSET_POINT);
	}
	else
	{
		glDisable(GL_POLYGON_OFFSET_POINT);
	}

	glPolygonOffset(pkOffsetState->Scale, pkOffsetState->Bias);
}
//---------------------------------------------------------------------------------------------------